package com.ybkj.daijia.server.model;


public class RentQuery {

    private Long id;

    private String appKey;

    private Integer page;

    private Integer rows;

    private Integer offset;


    public Long getId() {
        return id;
    }


    public void setId(Long id) {
        this.id = id;
    }


    public String getAppKey() {
        return appKey;
    }


    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }


    public Integer getPage() {
        return page;
    }


    public void setPage(Integer page) {
        this.page = page;
    }


    public Integer getRows() {
        return rows;
    }


    public void setRows(Integer rows) {
        this.rows = rows;
    }

    /**
     * 根据page和rows计算出偏移量.
     */
    public Integer getOffset() {
        if (getPage() == null || getRows() == null) {
            return null;
        }
        if (getPage() > 1) {
            return (getPage() - 1) * getRows();
        }

        return offset;
    }

    public void setOffset(Integer offset) {
        this.offset = offset;
    }


}
